home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr01 / halcn305.zip / GSDMO_05.PAS < prev    next >
Pascal/Delphi Source File  |  1993-05-02  |  2KB  |  82 lines

  1. program GSDMO_05;
  2. {------------------------------------------------------------------------------
  3.                              DBase File Appending
  4.  
  5.        Copyright (c)  Richard F. Griffin
  6.  
  7.        20 January 1993
  8.  
  9.        102 Molded Stone Pl
  10.        Warner Robins, GA  31088
  11.  
  12.        -------------------------------------------------------------
  13.        This program demonstrates how dBase files may be appended using
  14.        Griffin Solutions units.
  15.  
  16.        If the GSDMO_01.DBF file does not exist, the program will display a
  17.        a message that the file was not found and to run GSDMO_01 to make
  18.        the file.
  19.  
  20.        The program opens a dBase file, appends a record, and proceeds to
  21.        list selected fields from each record.
  22.  
  23.        New procedures/functions introduced are
  24.  
  25.                  Append
  26.                  ClearRecord
  27.                  Date
  28.                  DatePut
  29.  
  30. -------------------------------------------------------------------------------}
  31.  
  32. uses
  33.    GSOBShel,
  34.    {$IFDEF WINDOWS}
  35.       WinCRT,
  36.       WinDOS;
  37.    {$ELSE}
  38.       CRT,
  39.       DOS;
  40.    {$ENDIF}
  41.  
  42.  
  43. const
  44.    s1 = 'ALastName';
  45.    s2 = 'FirstNameMI';
  46.  
  47. begin
  48.    ClrScr;
  49.    if not FileExist('GSDMO_01.DBF') then
  50.    begin
  51.       writeln('File GSDMO_01.DBF not found.  Run GSDMO_01 to create.');
  52.       halt;
  53.    end;
  54.                        {The 'Real' example starts here}
  55.  
  56.    Select(1);
  57.    Use('GSDMO_01');
  58.  
  59.                  {Insert a record}
  60.  
  61.    ClearRecord;                   {Put spaces in the record buffer area}
  62.    StringPut('LASTNAME',s1);      {Store s1 in LASTNAME}
  63.    StringPut('FIRSTNAME',s2);     {Store s2 in FIRSTNAME}
  64.    DatePut('BIRTHDATE',Date);
  65.                                   {Put today's date in BIRTHDATE}
  66.    Append;                        {Append the record to the end of the file}
  67.  
  68.                  {Now read the records}
  69.  
  70.    GoTop;
  71.    while not dEOF do
  72.    begin
  73.       writeln(FieldGet('LASTNAME'),' ',
  74.               FieldGet('FIRSTNAME'),'  ',
  75.               FieldGet('BIRTHDATE'));
  76.       Skip(1);
  77.    end;
  78.    CloseDataBases;
  79.    write('Press any Key to continue:');
  80.    repeat until KeyPressed;
  81. end.
  82.